import axios from "axios"
import env from "@/config/env"

let serve = axios.create({
  // 请求超时时间
  timeout: env.envTimeout,
})

serve.interceptors.request.use(config => {
  
  // console.log('请求', config);
  return config
}, err => {
  return Promise.reject(err);
})

serve.interceptors.response.use(ret => {
  // console.log('响应', ret);
  return ret.data
}, err => {
  return Promise.reject(err);
})

export const get = (url, config = {}) => serve.get(url, config)

export const post = (url, data, config = {}) => serve.post(url, data, config)


